package com.weitu.permission.role.entity;

import com.weitu.permission.roleGroup.entity.RoleGroup;
import com.weitu.permission.user.entity.UserRole;

import java.io.Serializable;
import java.util.List;

/**
 * Created by smp on 2017/3/17.
 */
public class Role implements Serializable{
    /**
     * id
     * Column: SYS_ROLE.id
     */
    private String id;
    /**
     * 角色编号
     * Column: SYS_ROLE.code
     */
    private String code;
    /**
     * 角色名称
     * Column: SYS_ROLE.name
     */
    private String name;
    /**
     * 角色组id
     * Column: SYS_ROLE.groupId
     */
    private String groupId;
    /**
     * 备注
     * Column: SYS_ROLE.remarks
     */
    private String remarks;
    /**
     * 删除标记 0 未删除 1 已删
     * Column: SYS_ROLE.delState
     */
    private Integer delState;
    /**
     * 排序号
     * Column: SYS_ROLE.sort
     */
    private Integer sort;
    /**
     * 添加人ID
     * Column: SYS_ROLE.addUserId
     */
    private String addUserId;
    /**
     * 添加时间
     * Column: SYS_DICTIONARY.addTime
     */
    private String addTime;
    /**
     * 最后一次修改人ID
     * Column: SYS_ROLE.updateUserId
     */
    private String updateUserId;
    /**
     * 最后一次修改时间
     * Column: SYS_ROLE.updateTime
     */
    private String updateTime;
    /**
     * 所属的角色组
     * Column: SYS_ROLE.roleGroup
     */
    private RoleGroup roleGroup;
    /**用户角色关联表
     * Column: SYS_ROLE.userRole
     */
    private UserRole userRole;
    /**
     * 角色权限关联列表
     */
    private List<RoleAuthority> roleAuthorityList;

    public void setId(String id) {
        this.id = id;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public void setDelState(Integer delState) {
        this.delState = delState;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public void setAddUserId(String addUserId) {
        this.addUserId = addUserId;
    }

    public void setAddTime(String addTime) {
        this.addTime = addTime;
    }

    public void setUpdateUserId(String updateUserId) {
        this.updateUserId = updateUserId;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public void setRoleGroup(RoleGroup roleGroup) {
        this.roleGroup = roleGroup;
    }

    public String getId() {
        return id;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getGroupId() {
        return groupId;
    }

    public String getRemarks() {
        return remarks;
    }

    public Integer getDelState() {
        return delState;
    }

    public Integer getSort() {
        return sort;
    }

    public String getAddUserId() {
        return addUserId;
    }

    public String getAddTime() {
        return addTime;
    }

    public String getUpdateUserId() {
        return updateUserId;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public RoleGroup getRoleGroup() {
        return roleGroup;
    }

    public UserRole getUserRole() {
        return userRole;
    }

    public void setUserRole(UserRole userRole) {
        this.userRole = userRole;
    }

    public List<RoleAuthority> getRoleAuthorityList() {
        return roleAuthorityList;
    }

    public void setRoleAuthorityList(List<RoleAuthority> roleAuthorityList) {
        this.roleAuthorityList = roleAuthorityList;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Role role = (Role) o;

        if (id != null ? !id.equals(role.id) : role.id != null) return false;
        if (code != null ? !code.equals(role.code) : role.code != null) return false;
        if (name != null ? !name.equals(role.name) : role.name != null) return false;
        if (groupId != null ? !groupId.equals(role.groupId) : role.groupId != null) return false;
        if (remarks != null ? !remarks.equals(role.remarks) : role.remarks != null) return false;
        if (delState != null ? !delState.equals(role.delState) : role.delState != null) return false;
        if (sort != null ? !sort.equals(role.sort) : role.sort != null) return false;
        if (addUserId != null ? !addUserId.equals(role.addUserId) : role.addUserId != null) return false;
        if (addTime != null ? !addTime.equals(role.addTime) : role.addTime != null) return false;
        if (updateUserId != null ? !updateUserId.equals(role.updateUserId) : role.updateUserId != null) return false;
        if (updateTime != null ? !updateTime.equals(role.updateTime) : role.updateTime != null) return false;
        if (roleGroup != null ? !roleGroup.equals(role.roleGroup) : role.roleGroup != null) return false;
        if (userRole != null ? !userRole.equals(role.userRole) : role.userRole != null) return false;
        return roleAuthorityList != null ? roleAuthorityList.equals(role.roleAuthorityList) : role.roleAuthorityList == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
        result = 31 * result + (remarks != null ? remarks.hashCode() : 0);
        result = 31 * result + (delState != null ? delState.hashCode() : 0);
        result = 31 * result + (sort != null ? sort.hashCode() : 0);
        result = 31 * result + (addUserId != null ? addUserId.hashCode() : 0);
        result = 31 * result + (addTime != null ? addTime.hashCode() : 0);
        result = 31 * result + (updateUserId != null ? updateUserId.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (roleGroup != null ? roleGroup.hashCode() : 0);
        result = 31 * result + (userRole != null ? userRole.hashCode() : 0);
        result = 31 * result + (roleAuthorityList != null ? roleAuthorityList.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Role{");
        sb.append("id='").append(id).append('\'');
        sb.append(", code='").append(code).append('\'');
        sb.append(", name='").append(name).append('\'');
        sb.append(", groupId='").append(groupId).append('\'');
        sb.append(", remarks='").append(remarks).append('\'');
        sb.append(", delState=").append(delState);
        sb.append(", sort=").append(sort);
        sb.append(", addUserId='").append(addUserId).append('\'');
        sb.append(", addTime='").append(addTime).append('\'');
        sb.append(", updateUserId='").append(updateUserId).append('\'');
        sb.append(", updateTime='").append(updateTime).append('\'');
        sb.append(", roleGroup=").append(roleGroup);
        sb.append(", userRole=").append(userRole);
        sb.append(", roleAuthorityList=").append(roleAuthorityList);
        sb.append('}');
        return sb.toString();
    }
}
